home *** CD-ROM | disk | FTP | other *** search
/ Sprite 1984 - 1993 / Sprite 1984 - 1993.iso / src / lib / tclX6.4c / dist / tests / stringfil.test < prev    next >
Encoding:
Text File  |  1992-11-07  |  1.4 KB  |  51 lines

  1. #
  2. # stringfil.test
  3. #
  4. # Tests for tcl.tlib string file I/O functions.
  5. #---------------------------------------------------------------------------
  6. # Copyright 1992 Karl Lehenbauer and Mark Diekhans.
  7. #
  8. # Permission to use, copy, modify, and distribute this software and its
  9. # documentation for any purpose and without fee is hereby granted, provided
  10. # that the above copyright notice appear in all copies.  Karl Lehenbauer and
  11. # Mark Diekhans make no representations about the suitability of this
  12. # software for any purpose.  It is provided "as is" without express or
  13. # implied warranty.
  14. #------------------------------------------------------------------------------
  15. # $Id: stringfil.test,v 2.0 1992/10/16 04:50:18 markd Rel $
  16. #------------------------------------------------------------------------------
  17. #
  18.  
  19. if {[info procs test] == ""} then {source testlib.tcl}
  20.  
  21. rename SAVED_UNKNOWN unknown
  22.  
  23. set stringfileTestVar {a
  24. b
  25. c
  26. d
  27. e
  28. f
  29. g}
  30.  
  31. unlink -nocomplain STRINGFIL.TEST
  32.  
  33. test stringfile-1.1 {write_file command} {
  34.     write_file STRINGFIL.TEST $stringfileTestVar
  35. } ""
  36.  
  37. test stringfile-2.1 {read_file command} {
  38.     read_file STRINGFIL.TEST
  39. } "$stringfileTestVar\n"
  40.  
  41. test stringfile-2.2 {read_file command} {
  42.     read_file STRINGFIL.TEST nonewline
  43. } "$stringfileTestVar"
  44.  
  45. test stringfile-2.3 {read_file command} {
  46.     read_file STRINGFIL.TEST 3
  47. } [crange $stringfileTestVar 0 2]
  48.  
  49. unlink STRINGFIL.TEST
  50. rename unknown SAVED_UNKNOWN
  51.